package vn.demand.dragon.controller
{
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	import vn.demand.dragon.model.vo.Company;
	import vn.demand.dragon.view.QuickCompanyMediator;
	
	public class OpenCustomerFormCommand extends SimpleCommand
	{
		override public function execute( note:INotification ) :void    
		{
			if (!facade.hasMediator(QuickCompanyMediator.NAME)) {
				facade.registerMediator(new QuickCompanyMediator(QuickCompanyMediator.NAME));
			}
			var mediator:QuickCompanyMediator = facade.retrieveMediator(QuickCompanyMediator.NAME) as QuickCompanyMediator;
			
			var company:Company = note.getBody() as Company;
			if (null == company) {
				company = new Company();
			}
			mediator.show(company);
        }
	}
}